<div ng-init="vm.init();refresh();">
  <div class="row x-page-header">
    <div class="col-md-12">
      <div class="x-page-title">MOCK 数据模块</div>
      <div class="pull-right" ng-if="sessionUser.role">
        <button class="btn btn-primary" type="button" ng-click="vm.edit()"
            ng-if="sessionUser.role == 'admin'">添加模块</button>
        <a class="btn btn-success" href="#!/mock-history" target="_blank" ng-if="vm.modules.length > 0">版本历史</a>
      </div>
    </div>
  </div>
  <div class="row x-page-body">
    <div class="col-md-12">
      <div class="row x-module-list">
        <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3" ng-repeat="module in vm.modules">
          <div class="thumbnail">
            <div class="caption">
              <h1 ng-class="{'x-readonly': !sessionUser.role}">
                <a ng-href="{{'#!/mock-editor/' + module.name}}">{{module.name}}</a>
              </h1>
              <p class="text-right" ng-if="sessionUser.role">
                <button class="btn btn-success" ng-click="vm.proxy(module.name)" title="代理配置"
                    ng-disabled="!module.proxy"><i class="fa fa-server"></i> {{module.port}}</button>
                <button class="btn btn-primary" ng-click="vm.edit(module.name)"
                    ng-if="sessionUser.role == 'admin'" title="编辑"><i class="fa fa-pencil"></i></button>
                <button class="btn btn-danger" ng-click="vm.remove(module.name)"
                    ng-if="sessionUser.role == 'admin'" title="删除"><i class="fa fa-trash-o"></i></button>
              </p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
